#include<bits/stdc++.h>
using namespace std;
vector<int> x1, x2, yy, y2;
#define VNAME(name) (#name)
#define F_(n) cout << fixed << setprecision(n)
#define gc() (ibo_ == ied_ ? (ied_ = buf + fread(ibo_ = buf, 1, 1 << 20, stdin), ibo_ == ied_ ? EOF : *ibo_++) : *ibo_++)
#define read() ({ int x = 0, f = 1; char c = gc(); while(c < '0' || c > '9') { if (c == '-') f = -1; c = gc();} while(c >= '0' && c <= '9') x = x * 10 + (c & 15), c = gc(); f * x; })
char buf[1 << 20], puf[1 << 20], *_p_ = puf, *ibo_, *ied_;
#define pr(x) (_p_ - puf == 1 << 20 ? (fwrite(puf, 1, 1 << 20, stdout), _p_ = puf) : 0, *_p_++ = x)
int print(long long x) { return x <= 9 ? pr(x + '0') : (print(x / 10), pr(x % 10 + '0')); }
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 255;
const int MOD = 1e9 + 7;
mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());
bool _OJ_Flag = true;
int arr[N];
int main(){
    vector<int> g;
    int n = 16, n_ = n >> 1; 
    for (int i = 2; i < n; ++ i) g.push_back(i);
    int res = 0;
    do {
        vector<int> a, b;
        bool flag = true; int num = 0;
        int spz[3][10]; spz[1][1] = 1; spz[2][n_] = n;
        for (int i = 2; i <= n_; ++ i) spz[1][i] = g[num ++];
        for (int i = 1; i < n_; ++ i) spz[2][i] = g[num ++];

        for (int i = 2; i <= n_; ++ i) {
            if (spz[1][i] > spz[2][i] || spz[1][i - 1] > spz[1][i] || spz[2][i - 1] > spz[2][i]) {
                flag = false;
                break;
            }
        }
        //for (int i = 1; i <= n_; ++ i) cout << spz[1][i] << ' '; cout << endl;
        //for (int i = 1; i <= n_; ++ i) cout << spz[2][i] << ' '; cout << endl << flag << endl;
        if (flag) {
            cout << res ++ << endl;
        }
        //cout << "A";
    } while (next_permutation(g.begin(), g.end()));
    cout << res << endl;
    system("pause");
    return 0;
}